import logging

def setup_logger():
    logging.basicConfig(
        level=logging.INFO,
        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
        handlers=[
            logging.FileHandler("app.log"), # 输出到文件
            logging.StreamHandler() # 输出到控制台
        ]
    )
    return logging.getLogger(__name__)

# 然后在 app.py 顶部导入并使用
# from utils.logger import setup_logger
# logger = setup_logger()
# 将 print() 替换为 logger.info()